<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<style>
		*{
			margin:0;
			padding:0;
		}
			.main{
			
			word-wrap : break-word ;
			word-break:break-all;
				padding:0.3rem;
				height:auto;
				font-size: 0.3rem;
			}
			.title{
				width:100%;
				/* height:1.2rem; */
				line-height: 0.6rem;
				font-size: 0.3rem;
				color:red;
				border-bottom: 3px double red;
				text-align: center;
				margin-bottom: 0.5rem;
			}
			.content{
				color:#333;
				text-indent:2em;
			}
			.fujian{
				width:100%;
				min-height: 2rem;
				display:none;
			}
		</style>
	</head>
	<body>
		<div class='main'>
			<div class='title'></div>
			<div class='content'></div>
			<div class="fujian"></div>
			<!--<div class='attach'>
				
			</div>-->
		</div>
		<script type="text/javascript" src="../../js/jquery-1.11.0.js" ></script>
		<script type="text/javascript" src="../../js/aikxian-common.js" ></script>
		<script type="text/javascript" src="../../js/common.js?id=0001" ></script>
		<script type="text/javascript" src="../../js/rem.js" ></script>
		<script type="text/javascript" src="../../js/Base64.min.js" ></script>
		<script>
			$(window).load(function(){
				
				//====
//				var noticeId得从APP获取取，optionId:公告项id  
				var noticeId=$.getUrlParam('noticeId');
				var optionId=$.getUrlParam('optionId');
//noticeId: 1 营销公告 2客服公告 3运营消息 4产品消息
//				var noticeId="3";
//				var optionId="00000000000000000262";

				var str="{ 'noticeId':'"+noticeId+"','optionId':'"+optionId+"'}";
				
				str = Base64.encode(str);
				jQuery(function(){
					jQuery.ajax({
						url:market,
						type:"post",
						dataType:"text",
						data:{commonURL:market,"opName":"get_noticedetail",'param':str,'osFlag':'5'},
						async:false,
						success:function(serverinfo){
							
							var Data=Base64.decode(serverinfo);
							/* var Data=decodeURI(Base64.decode(serverinfo)); */
							Data=JSON.parse(Data);
							if(Data.retCode==0){
								$('title').html(Data.title);
								$('.title').html(Data.title);
								$('.content').html(Data.content);
								var windowWidth=$(window).width();
								$(".content").find("*").each(function(){
									if($("table")){
										
									
										if($(this).width()>windowWidth){
											$(this).not("table").css("width","100%");
										}
									}	
									
								})
								
								
								
							}else{
								$(".main").html('暂无数据')
							};
							console.log(Data);
						}
					});
				});
				//附件获取函数
				//if(noticeId==3||noticeId==4){
					fujian();
				//}
				function fujian(){
						jQuery.ajax({
						url:market,
						type:"post",
						dataType:"text",
						data:{commonURL:market,"opName":"get_noticeoption_filelist",'param':str,'osFlag':'5'},
						async:false,
						success:function(serverinfo){
							console.log(serverinfo);
							var Data=Base64.decode(serverinfo);
//							var Data=decodeURI(Base64.decode(serverinfo));
							Data=JSON.parse(Data);
							if(Data.retCode==0){
								console.log(Data.content);
								for(var i=0;i<Data.content.length;i++){
									var div='<div class="fujian_message" style="width:100%;height:1rem;overflow:hidden;" value='+Data.content[i].value+'><img src="'
									+Data.content[i].type
									+'"style="width:0.5rem;height:0.5rem;position:relative;top:0.1rem;margin:0 0.2rem"/><span style="font-size:0.28rem;color:red;line-height:1rem;">'+Data.content[i].title+'</span></div>'
								$(".main").append(div);
								}
								
								//
								$(".fujian_message").click(function(){
									var href=$(this).attr('value');
									//if (navigator.userAgent.toLowerCase().match(/android/i) == "android"){
										//window.location.href=href;
									//}else{
										window.location.href=href;
										//window.webkit.messageHandlers.AppModel.postMessage({title: '详情', body: 'objc:///linkTo:'+href});
									//}
								})
							}else{
								$(".main").html('暂无数据')
							};
							
						}
					});
				}
				
				
			
			//====		
	});
		</script>
	</body>
</html>
